@REM Copyright (C) Microsoft Corporation. All rights reserved.

@if not "%_echo%"=="1" (echo off)
setlocal enabledelayedexpansion

set CONFIGURATION=%~1

@REM Usage: tests.cmd [Release|Debug]

@REM Add .NET 2.0 Framework directory to the path to find msbuild.exe.
set PATH=%windir%\Microsoft.NET\Framework\v2.0.50727;%PATH%

@REM Call msbuild.exe to invoke the runtests target.

call msbuild.exe /t:RunTests /p:Configuration=%~1 "%~dp0runtests.targets"
if not "!ERRORLEVEL!"=="0" (exit /b !ERRORLEVEL!)

if "%CONFIGURATION%" == "Release" (
@REM We call Uninstall.cmd to try uninstalling TFSAdmin after the tests finish.
call "%~dp0..\Installer\Uninstall.cmd"
)

exit /b !ERRORLEVEL!